package com.hippomeetsskunk.savanna.types.meta;

import com.hippomeetsskunk.savanna.types.person.Skill;
import com.hippomeetsskunk.savanna.types.person.Skills;


public class EdibleType extends ResourceType {

	public final static EdibleType EDIBLE = new EdibleType("edible", null, 0.0, 0.0, 0.0, new Skills(Skill.CONSERVATION, 0.01), (ResourceType[]) null);
	
	public final static EdibleType MEAT = new EdibleType("meat", EDIBLE, 0.0, 0.0, 0.0, null, (ResourceType[]) null);
	public final static EdibleType VEGETABLE = new EdibleType("vegetable", EDIBLE, 0.0, 0.0, 0.0, null, (ResourceType[]) null);

	public final static EdibleType ZUCCHINI = new EdibleType("zucchini", VEGETABLE, 30.0, 10.0, 0.0, null, (ResourceType[]) null);
	public final static EdibleType PORK_MEAT = new EdibleType("pork meat", MEAT, 10.0, 10.0, 0.0, null, (ResourceType[]) null);
	public final static EdibleType SMOKED_PORK_MEAT = new EdibleType("smoked pork meat", MEAT, 200.0, 5.0, 0.0, null, (ResourceType[]) null);
	
	private final static EdibleType[] values = new EdibleType[] {
		EDIBLE,
		MEAT,
		VEGETABLE,
		ZUCCHINI,
		PORK_MEAT,
		SMOKED_PORK_MEAT
	};
	
	private final static EdibleType[] foodTypes = new EdibleType[] {
		MEAT,
		VEGETABLE
	};
	
	private EdibleType(String type, EdibleType parent, double lifeTime, double difficulty, double fragility){
		this(type, parent, lifeTime, difficulty, fragility, null, (ResourceType[]) null);
	}
	
	private EdibleType(String type, EdibleType parent, double lifeTime, double difficulty, double fragility, Skills skillsForImprovement, ResourceType ... resourcesForImprovement){
		super(type, parent, lifeTime, difficulty, fragility, skillsForImprovement, resourcesForImprovement);
	}
	
	public static EdibleType[] values() {
		return values;
	}
	
	public static EdibleType[] foodTypes() {
		return foodTypes;
	}
	
	public EdibleType getFoodType(){
		for(EdibleType t : foodTypes){
			if (isA(t)) return t;
		}
		throw new IllegalStateException("Edible " + this + " is not a food type!");
	}
}
